//获取UserId
function getUserId(code, agentid,suc_fun){
	// 加了一个 agentid
	// alert(vUrlPath + 'wechat/mobile/getUserId?' + vUrlParam + '&code=' + code+'&agentid='+agentid)
	$.ajax({
		url:vUrlPath + 'wechat/mobile/getUserId?' + vUrlParam + '&code=' + code+'&agentid='+agentid,
		type:'post',  
		async:false,  
		dataType:'json', 
		success:function(data) {
			suc_fun(data.data);
		},
		error:function(data) {
			console.log("can not get UserId");
		}
	}); 
}

function SetCookie(name, value)
{ 
	var exp = new Date(); 
	exp.setTime(exp.getTime() + (30*24*60*60*1000));
	window.document.cookie = name + "=" + escape (value) + "; expires=" + exp.toGMTString()+";path=/";
}

function GetCookie(name) 
{ 
	var arg = name + "="; 
	var alen = arg.length; 
	var clen = window.document.cookie.length; 
	var i = 0; 
	while (i < clen) 
	{ 
		var j = i + alen; 
		if (window.document.cookie.substring(i, j) == arg) return getCookieVal (j); 
		i = window.document.cookie.indexOf(" ", i) + 1; 
		if (i == 0)
			break; 
	} 
	return null;
}

